If I have a grammar like this:
HLMModel :
'module' name=ID '(' (inputs+=ID (',' inputs+=ID)*)? ')'
('returns' '(' (outputs+=ID (',' outputs+=ID)*) ')')? '{'
startup=Startup
(states+=MyState)+
'}'
;
Startup :
'startup' '{' nextState=[MyState] '}' ;
MyState :
'state' name=ID '{' 'next' '=' nextState=[MyState] '}';
and an example like this:
module T() {
startup {a}
state a { next = b}
state b { next = a}
}
The cross-referencing to the State doesn't seem to work. However, if I change my HLMModel rule by commenting out the 'module' part, i.e.,
HLMModel :
// 'module' name=ID '(' (inputs+=ID (',' inputs+=ID)*)? ')'
// ('returns' '(' (outputs+=ID (',' outputs+=ID)*) ')')? '{'
startup=Startup
(states+=MyState)+
'}'
;
Then, cross-referencing works OK. What am I doing wrong in the above grammar? Thank you for any ideas.